$(function(){
    var a6 = [0,1,2,3,4,5,6,7,8,9];
    var i = 0, y = $('.barIcon5').html();
    var time = 0,tan = true,dialog =  $('#dialog'),delay1=$('#delay1'),delay2=$('#delay2');
    setInterval(function(){
        if(i > 9){
           i = 0; 
           if(y>9) y =0 ;
           $('.barIcon5').html(y);
           ++y;
        } 
        $('.barIcon6').html(a6[i]);
        ++i;
    },300);
    $('.cancel-icon').on('click',function(){
        dialog.css('display', 'none');
        tan = true;
    });
    function show(){
        dialog.css('display', 'block');
        delay1.css('display', 'block');
        delay2.css('display', 'none');
    }
    setInterval(function(){
        if(tan) time ++;
        if(time == 3||time == 18&&dialog.css('display')=='none'){
            if(time == 3){ tan = false;}
            show();
        }
        if(time == 38){
            dialog.css('display', 'block');
            delay1.css('display', 'none');
            delay2.css('display', 'block');
        } 
        if(time == 68){
            show();
            tan = false;
            time = 3;
        }
    },1000)
})